#include "SphereP.h"

SphereP::SphereP( float radius, int slices, int stacks,Material *mat,Texture *tex ): Primitive(mat,tex)
{
	this->radius=radius;
	this->slices=slices;
	this->stacks=stacks;
	glQ = gluNewQuadric();
	gluQuadricDrawStyle(glQ, GLU_FILL);		
	gluQuadricNormals(glQ, GLU_SMOOTH);		
	gluQuadricOrientation(glQ, GLU_OUTSIDE);
	gluQuadricTexture(glQ, GL_TRUE);
}

void SphereP::act(float texLS, float texLT){

	float ls,lt;
	if(tex->inheritTex){
		ls=texLS;
		lt=texLT;
	}
	else{
		ls=getTex()->getLengthS();
		lt=getTex()->getLengthT();
	}

	getMat()->act();
	getTex()->act();
	
	gluSphere(glQ,radius,slices,stacks);
	
}
